﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Web;

public class FileHelper
{
    private static string file = HttpContext.Current.Request.PhysicalApplicationPath + "App_Data/new_word_type.txt";
    public static bool WriteTextFile(string content)
    {
        try
        {
            string time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff");//获取当前系统时间
                                                                           //创建或打开日志文件，向日志文件末尾追加记录
            using (StreamWriter mySw = File.AppendText(file))
            {
                string write_content = time + ": " + content;
                mySw.WriteLine(write_content);
                mySw.Close();
            }
            return true;
        }
        catch (Exception ex) { return false; }
    }
}
